package com.supermarket.shop.system.service.impl;

import com.supermarket.shop.system.dao.CommodityDao;
import com.supermarket.shop.system.dao.impl.CommodityDaoImpl;
import com.supermarket.shop.system.domain.Commodity;
import com.supermarket.shop.system.service.ServiceCommodity;

import java.io.IOException;
import java.util.ArrayList;

public class CommodityServiceImpl implements ServiceCommodity {
    private static CommodityDao commodityDaoImpl = new CommodityDaoImpl();

    @Override
    public void BufferedWriterFile(Commodity com) throws IOException {
        commodityDaoImpl.BufferedWriterFile(com);
    }

    @Override
    public ArrayList<Commodity> BufferedReaderFile() throws IOException {
        return commodityDaoImpl.BufferedReaderFile();
    }

    @Override
    public boolean isExist(String name) throws IOException {
        return commodityDaoImpl.isExist(name);
    }

    @Override
    public Integer maxCommodityId() throws IOException {
        return commodityDaoImpl.maxCommodityId();
    }

    @Override
    public boolean addCommodity(Commodity commodity) throws IOException {
        return commodityDaoImpl.addCommodity(commodity);
    }

    @Override
    public void findAllCommodity() throws IOException {
        commodityDaoImpl.findAllCommodity();
    }

    @Override
    public void deleteCommodityByName(String name) throws IOException {
        commodityDaoImpl.deleteCommodityByName(name);
    }

    @Override
    public void updateCommodityByname(Commodity commodity,String nameupdate) throws IOException {
        commodityDaoImpl.updateCommodityByname(commodity,nameupdate);
    }

}
